<template>
  <div id="app">
    <router-view class="main"></router-view>
    <van-tabbar
      v-show="isShowTabBar"
      active-color="deeppink"
      :fixed="false"
      route
    >
      <van-tabbar-item icon="label-o" :to="{ name: 'Home' }"
        >首页</van-tabbar-item
      >
      <van-tabbar-item icon="hot-o" :to="{ name: 'List' }"
        >热卖</van-tabbar-item
      >
      <van-tabbar-item icon="shopping-cart-o" :to="{ name: 'Cart' }"
        >购物车</van-tabbar-item
      >
      <van-tabbar-item icon="manager-o" :to="{ name: 'User' }"
        >我的</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>
<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      isShowTabBar: true,
    };
  },
  methods: {
    showTip() {
      Toast.success("哈哈");
    },
  },
  watch: {
    $route(v) {
      //判断 跳转的页面是否需要隐藏底部导航
      if (v.meta.hideTabBar) {
        this.isShowTabBar = false;
      } else {
        this.isShowTabBar = true;
      }
    },
  },
};
</script>
<style lang="scss">
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body,
#app {
  width: 100vw;
  height: 100vh;
}
#app {
  display: flex;
  flex-direction: column;
}
.main {
  flex: 1;
  overflow: auto;
}
</style>
